package com.csthink.web.interfaces;

import com.csthink.mysql.entity.Account;
import com.csthink.mysql.entity.User;
import com.csthink.web.application.dto.test.AccountSetupRequest;
import com.csthink.web.application.service.AccountService;
import com.csthink.web.application.service.UserService;
import io.swagger.annotations.Api;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @author <a href="mailto:security.2009@live.cn">Mars</a>
 * @since 2023-09-10
 */
@Api(tags = "Test 模块")
@RestController
@RequestMapping(value = "/mybatis")
public class MyBatisTestController {

    @Setter(onMethod_ = @Autowired)
    private AccountService accountService;

    @Resource
    private UserService userService;


    @PostMapping("/account-setup")
    public User setUpAccount(@Valid @RequestBody AccountSetupRequest request) {
        return accountService.initAccount(request);
    }


}
